package com.captjack.common.util.math;

import com.captjack.common.util.math.map.MapUtils;

/**
 * 经纬度坐标点
 *
 * @author Jack Sparrow
 * @version 1.0.0
 * @date 2018/8/29 15:03
 * package com.sinoiov.gghypt.enforcelaw.common
 */
public final class LocationPoint {

    /**
     * 经度
     */
    private final double longitude;

    /**
     * 纬度
     */
    private final double latitude;

    /**
     * 唯一构造函数
     *
     * @param longitude 经度
     * @param latitude  纬度
     */
    public LocationPoint(double longitude, double latitude) {
        this.longitude = longitude;
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    /**
     * 计算当前点到某点的距离
     *
     * @return 两个经纬度（点）的距离
     */
    public double calculateDistanceToOtherPoint(LocationPoint locationPoint) {
        return MapUtils.calculateDistanceBetweenTwoPoint(this, locationPoint);
    }

}
